


<!DOCTYPE html>
<html id="htmlId">
<head>
  <title>Coverage Report > SquareTest</title>
  <style type="text/css">
    @import "../../css/coverage.css";
    @import "../../css/highlight-idea.css";
  </style>
  <script type="text/javascript" src="../../js/highlight.pack.js"></script>
</head>

<body>
<div class="content">
<div class="breadCrumbs">
Current scope:     <a href="../../index.html">all classes</a>
    <span class="separator">|</span>
    <a href="../index.html">nl.tudelft.jpacman.board</a>
</div>

<h1>Coverage Summary for Class: SquareTest (nl.tudelft.jpacman.board)</h1>

<table class="coverageStats">
<tr>
  <th class="name">Class</th>
<th class="coverageStat 
">
  Class, %
</th>
<th class="coverageStat 
">
  Method, %
</th>
<th class="coverageStat 
">
  Line, %
</th>
</tr>
<tr>
  <td class="name">SquareTest</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/1)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/5)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/14)
  </span>
</td>
</tr>

</table>

<br/>
<br/>


<pre>
<div class="sourceCode" id="sourceCode"><i class="no-highlight">1</i>&nbsp;package nl.tudelft.jpacman.board;
<i class="no-highlight">2</i>&nbsp;
<i class="no-highlight">3</i>&nbsp;import org.junit.jupiter.api.BeforeEach;
<i class="no-highlight">4</i>&nbsp;import org.junit.jupiter.api.Test;
<i class="no-highlight">5</i>&nbsp;
<i class="no-highlight">6</i>&nbsp;import static org.assertj.core.api.Assertions.assertThat;
<i class="no-highlight">7</i>&nbsp;import static org.mockito.Mockito.mock;
<i class="no-highlight">8</i>&nbsp;
<i class="no-highlight">9</i>&nbsp;/**
<i class="no-highlight">10</i>&nbsp; * Test suite to confirm the public API of {@link Square} works as desired.
<i class="no-highlight">11</i>&nbsp; *
<i class="no-highlight">12</i>&nbsp; * @author Jeroen Roosen 
<i class="no-highlight">13</i>&nbsp; */
<b class="nc"><i class="no-highlight">14</i>&nbsp;class SquareTest {</b>
<i class="no-highlight">15</i>&nbsp;
<i class="no-highlight">16</i>&nbsp;    /**
<i class="no-highlight">17</i>&nbsp;     * The square under test.
<i class="no-highlight">18</i>&nbsp;     */
<i class="no-highlight">19</i>&nbsp;    private Square square;
<i class="no-highlight">20</i>&nbsp;
<i class="no-highlight">21</i>&nbsp;    /**
<i class="no-highlight">22</i>&nbsp;     * Resets the square under test.
<i class="no-highlight">23</i>&nbsp;     */
<i class="no-highlight">24</i>&nbsp;    @BeforeEach
<i class="no-highlight">25</i>&nbsp;    void setUp() {
<b class="nc"><i class="no-highlight">26</i>&nbsp;        square = new BasicSquare();</b>
<i class="no-highlight">27</i>&nbsp;    }
<i class="no-highlight">28</i>&nbsp;
<i class="no-highlight">29</i>&nbsp;    /**
<i class="no-highlight">30</i>&nbsp;     * Assert that the square holds the occupant once it has occupied it.
<i class="no-highlight">31</i>&nbsp;     */
<i class="no-highlight">32</i>&nbsp;    @Test
<i class="no-highlight">33</i>&nbsp;    void testOccupy() {
<b class="nc"><i class="no-highlight">34</i>&nbsp;        Unit occupant = mock(Unit.class);</b>
<b class="nc"><i class="no-highlight">35</i>&nbsp;        square.put(occupant);</b>
<i class="no-highlight">36</i>&nbsp;
<b class="nc"><i class="no-highlight">37</i>&nbsp;        assertThat(square.getOccupants()).contains(occupant);</b>
<i class="no-highlight">38</i>&nbsp;    }
<i class="no-highlight">39</i>&nbsp;
<i class="no-highlight">40</i>&nbsp;    /**
<i class="no-highlight">41</i>&nbsp;     * Assert that the square no longer holds the occupant after it has left the
<i class="no-highlight">42</i>&nbsp;     * square.
<i class="no-highlight">43</i>&nbsp;     */
<i class="no-highlight">44</i>&nbsp;    @Test
<i class="no-highlight">45</i>&nbsp;    void testLeave() {
<b class="nc"><i class="no-highlight">46</i>&nbsp;        Unit occupant = mock(Unit.class);</b>
<b class="nc"><i class="no-highlight">47</i>&nbsp;        square.put(occupant);</b>
<b class="nc"><i class="no-highlight">48</i>&nbsp;        square.remove(occupant);</b>
<i class="no-highlight">49</i>&nbsp;
<b class="nc"><i class="no-highlight">50</i>&nbsp;        assertThat(square.getOccupants()).doesNotContain(occupant);</b>
<i class="no-highlight">51</i>&nbsp;    }
<i class="no-highlight">52</i>&nbsp;
<i class="no-highlight">53</i>&nbsp;    /**
<i class="no-highlight">54</i>&nbsp;     * Assert that the order in which units entered the square is preserved.
<i class="no-highlight">55</i>&nbsp;     */
<i class="no-highlight">56</i>&nbsp;    @Test
<i class="no-highlight">57</i>&nbsp;    void testOrder() {
<b class="nc"><i class="no-highlight">58</i>&nbsp;        Unit o1 = mock(Unit.class);</b>
<b class="nc"><i class="no-highlight">59</i>&nbsp;        Unit o2 = mock(Unit.class);</b>
<b class="nc"><i class="no-highlight">60</i>&nbsp;        square.put(o1);</b>
<b class="nc"><i class="no-highlight">61</i>&nbsp;        square.put(o2);</b>
<i class="no-highlight">62</i>&nbsp;
<b class="nc"><i class="no-highlight">63</i>&nbsp;        assertThat(square.getOccupants()).containsSequence(o1, o2);</b>
<i class="no-highlight">64</i>&nbsp;    }
<i class="no-highlight">65</i>&nbsp;}
</div>
</pre>
</div>

<script type="text/javascript">
(function() {
    var msie = false, msie9 = false;
    /*@cc_on
      msie = true;
      @if (@_jscript_version >= 9)
        msie9 = true;
      @end
    @*/

    if (!msie || msie && msie9) {
        var codeBlock = document.getElementById('sourceCode');

        if (codeBlock) {
            hljs.highlightBlock(codeBlock);
        }
    }
})();
</script>

<div class="footer">
    
    <div style="float:right;">generated on 2022-05-22 18:55</div>
</div>
</body>
</html>
